#!/bin/bash

p=$1

git am $p
if [ $? -ne 0 ]; then
  echo "git am patch failed"
  git am --abort
else
  exit 0
fi

read -p "Try patch manually? (Y/N)" try
if [ "X$try" = "Xy" ]; then
   patch -Np1 -i $p
else
   echo "patch apply failed, please check it out!"
fi

